program C;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, k, i, j, min, minK: integer;
  mass: array of integer;

begin
  read (n, k);
  setlength (mass, n);
  for i := 0 to n - 1 do
    read (mass[i]);

  for i := 0 to n-k do
  begin
    if min>mass[i+k-1] then
    begin
      min:= mass[i+k-1];
      minK:= i+k-1;
    end;
    if (minK<i) or (i=0) then
    begin
      min:= mass[i];
      minK:= i;
      for j := i to i+k-1 do
        if mass[j]<min then
        begin
          min:= mass[j];
          minK:= j;
        end;
    end;
    writeln (min);
  end;
end.
